package com.smg.community.model;

import cn.org.rapid_framework.util.DateConvertUtils;
import com.smg.community.util.ProjectUtil;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import javacommon.base.BaseEntity;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

public class SmgMember extends BaseEntity
  implements Serializable
{
  private static final long serialVersionUID = 1702993486L;
  public static final String TABLE_ALIAS = "SmgMember";
  public static final String ALIAS_MEMBER_ID = "memberId";
  public static final String ALIAS_LOGIN_NAME = "loginName";
  public static final String ALIAS_PASSWORD = "password";
  public static final String ALIAS_SIGNATURE = "signature";
  public static final String ALIAS_HEAD_IMAGE = "headImage";
  public static final String ALIAS_SEX = "sex";
  public static final String ALIAS_TOPIC_COUNT = "topicCount";
  public static final String ALIAS_EMAIL = "email";
  public static final String ALIAS_IS_EMAIL_VERIFY = "isEmailVerify";
  public static final String ALIAS_MOBILE_NUMBER = "mobileNumber";
  public static final String ALIAS_IS_MOBILE_VERIFY = "isMobileVerify";
  public static final String ALIAS_REG_SOURCE = "regSource";
  public static final String ALIAS_APP_SOURCE = "appSource";
  public static final String ALIAS_APP_VERSION = "appVersion";
  public static final String ALIAS_THIRD_PARTY_TOKEN = "thirdPartyToken";
  public static final String ALIAS_LAST_LOGIN_DATE = "lastLoginDate";
  public static final String ALIAS_REG_DATE = "regDate";
  public static final String FORMAT_LAST_LOGIN_DATE = "yyyy-MM-dd";
  public static final String FORMAT_REG_DATE = "yyyy-MM-dd";
  private String nickNameFirstChar;
  private Integer memberId;
  private String loginName;
  private String password;
  private String signature;
  private String headImage;
  private String sex;
  private Integer topicCount;
  private String email;
  private Integer isEmailVerify;
  private String mobileNumber;
  private Integer isMobileVerify;
  private String regSource;
  private String appSource;
  private String appVersion;
  private String thirdPartyToken;
  private Date lastLoginDate;
  private Date regDate;
  private String nickName;
  private int isNewMember;
  private int fansCount;
  private String distance;
  private int isFriend;
  private int isFocus;
  private int carBrandId;
  private String carBrandName;
  private int modelId;
  private String carModelName;
  private String cityAddress;
  private int memberCarType;
  private String uuid;
  private String largeImage;
  private int unReadMessageCount;
  private int unReadSystemMessageCount;
  private int age;
  private String job;
  private String interest;
  private String lastestBehavior;
  private int takeId;
  private int birthDay;
  private int birthMonth;
  private int birthYear;
  private String myCars;
  private String likeCars;
  private String constellation;
  private String lastBehaviorId;

  public SmgMember (){
	  
  }
  
  public String getNickNameFirstChar()
  {
    return this.nickNameFirstChar;
  }

  public void setNickNameFirstChar(String nickNameFirstChar) {
    this.nickNameFirstChar = nickNameFirstChar;
  }

  public String getUuid()
  {
    return this.uuid;
  }

  public void setUuid(String uuid) {
    this.uuid = uuid;
  }

  public int getCarBrandId()
  {
    return this.carBrandId;
  }

  public int getMemberCarType() {
    return this.memberCarType;
  }

  public String getLargeImage()
  {
    if (this.headImage != null) {
      if (this.headImage.indexOf("/650") != -1)
        this.largeImage = this.headImage.replaceAll("/650", "");

      if (this.headImage.indexOf("/120") != -1)
        this.largeImage = this.headImage.replaceAll("/120", "");

      if (this.headImage.indexOf("/203") != -1)
        this.largeImage = this.headImage.replaceAll("/203", "");

      if (this.headImage.indexOf("/70") != -1)
        this.largeImage = this.headImage.replaceAll("/70", "");
    }

    return this.largeImage;
  }

  public void setLargeImage(String largeImage) {
    this.largeImage = largeImage;
  }

  public void setMemberCarType(int memberCarType) {
    this.memberCarType = memberCarType;
  }

  public void setCarBrandId(int carBrandId) {
    this.carBrandId = carBrandId;
  }

  public String getCarBrandName() {
    if (this.carBrandName == null)
      return "";

    return this.carBrandName;
  }

  public void setCarBrandName(String carBrandName) {
    this.carBrandName = carBrandName;
  }

  public int getModelId() {
    return this.modelId;
  }

  public void setModelId(int modelId) {
    this.modelId = modelId;
  }

  public String getCarModelName() {
    if (this.carModelName == null)
      return "";

    return this.carModelName;
  }

  public void setCarModelName(String carModelName) {
    this.carModelName = carModelName;
  }

  public String getCityAddress() {
    return this.cityAddress;
  }

  public void setCityAddress(String cityAddress) {
    this.cityAddress = cityAddress;
  }

  public int getIsFriend() {
    return this.isFriend;
  }

  public void setIsFriend(int isFriend) {
    this.isFriend = isFriend;
  }

  public int getIsFocus() {
    return this.isFocus;
  }

  public void setIsFocus(int isFocus) {
    this.isFocus = isFocus;
  }

  public String getLastBehaviorId()
  {
    return this.lastBehaviorId;
  }

  public void setLastBehaviorId(String lastBehaviorId) {
    this.lastBehaviorId = lastBehaviorId;
  }

  public String getConstellation() {
    this.constellation = ProjectUtil.date2Constellation(this.birthMonth, this.birthDay);
    return this.constellation;
  }

  public void setConstellation(String constellation) {
    this.constellation = constellation;
  }

  public String getMyCars() {
    return this.myCars;
  }

  public void setMyCars(String myCars) {
    this.myCars = myCars;
  }

  public String getLikeCars() {
    return this.likeCars;
  }

  public void setLikeCars(String likeCars) {
    this.likeCars = likeCars;
  }

  public int getBirthDay() {
    return this.birthDay;
  }

  public void setBirthDay(int birthDay) {
    if (birthDay == 0)
      birthDay = 1;
    this.birthDay = birthDay;
  }

  public int getBirthMonth() {
    if (this.birthMonth == 0)
      this.birthMonth = 1;

    return this.birthMonth;
  }

  public void setBirthMonth(int birthMonth) {
    this.birthMonth = birthMonth;
  }

  public int getBirthYear() {
    if (this.birthYear == 0)
      this.birthYear = 1988;

    return this.birthYear;
  }

  public void setBirthYear(int birthYear) {
    this.birthYear = birthYear;
  }

  public int getTakeId() {
    return this.takeId;
  }

  public void setTakeId(int takeId) {
    this.takeId = takeId;
  }

  public int getUnReadMessageCount() {
    return this.unReadMessageCount;
  }

  public void setUnReadMessageCount(int unReadMessageCount) {
    this.unReadMessageCount = unReadMessageCount;
  }

  public int getUnReadSystemMessageCount() {
    return this.unReadSystemMessageCount;
  }

  public void setUnReadSystemMessageCount(int unReadSystemMessageCount) {
    this.unReadSystemMessageCount = unReadSystemMessageCount;
  }

  public int getAge() {
    int year = Calendar.getInstance().get(1);
    return (year - getBirthYear());
  }

  public void setAge(int age) {
    this.age = age;
  }

  public String getJob() {
    return this.job;
  }

  public void setJob(String job) {
    this.job = job;
  }

  public String getInterest() {
    return this.interest;
  }

  public void setInterest(String interest) {
    this.interest = interest;
  }

  public String getLastestBehavior() {
    return this.lastestBehavior;
  }

  public void setLastestBehavior(String lastestBehavior) {
    this.lastestBehavior = lastestBehavior;
  }

  public String getDistance() {
    return this.distance;
  }

  public void setDistance(String distance) {
    this.distance = distance;
  }

  public int getFansCount() {
    return this.fansCount;
  }

  public void setFansCount(int fansCount) {
    this.fansCount = fansCount;
  }

  public int getIsNewMember() {
    return this.isNewMember;
  }

  public SmgMember(Integer memberId)
  {
    this.memberId = memberId;
  }

  public void setMemberId(Integer value) {
    this.memberId = value;
  }

  public Integer getMemberId() {
    return this.memberId; }

  public void setLoginName(String value) {
    this.loginName = value;
  }

  public String getLoginName() {
    return this.loginName; }

  public void setPassword(String value) {
    this.password = value;
  }

  public String getPassword() {
    return this.password; }

  public void setSignature(String value) {
    this.signature = value;
  }

  public String getSignature() {
    return this.signature; }

  public void setHeadImage(String value) {
    this.headImage = value;
  }

  public String getHeadImage() {
    if ((this.headImage == null) || (this.headImage.trim().equals(""))) {
      this.headImage = "http://timg.ddmap.com/crm/small/2013-05-13/153520866.jpg";
    }

    return this.headImage; }

  public void setSex(String value) {
    this.sex = value;
  }

  public String getSex() {
    if (this.sex == null)
      this.sex = "m";

    return this.sex; }

  public void setTopicCount(Integer value) {
    this.topicCount = value;
  }

  public Integer getTopicCount() {
    return this.topicCount; }

  public void setEmail(String value) {
    this.email = value;
  }

  public String getEmail() {
    return this.email; }

  public void setIsEmailVerify(Integer value) {
    this.isEmailVerify = value;
  }

  public Integer getIsEmailVerify() {
    return this.isEmailVerify; }

  public void setMobileNumber(String value) {
    this.mobileNumber = value;
  }

  public String getMobileNumber() {
    return this.mobileNumber; }

  public void setIsMobileVerify(Integer value) {
    this.isMobileVerify = value;
  }

  public Integer getIsMobileVerify() {
    return this.isMobileVerify; }

  public void setRegSource(String value) {
    this.regSource = value;
  }

  public String getRegSource() {
    return this.regSource; }

  public void setAppSource(String value) {
    this.appSource = value;
  }

  public String getAppSource() {
    return this.appSource; }

  public void setAppVersion(String value) {
    this.appVersion = value;
  }

  public String getAppVersion() {
    return this.appVersion; }

  public void setThirdPartyToken(String value) {
    this.thirdPartyToken = value;
  }

  public String getThirdPartyToken() {
    return this.thirdPartyToken; }

  public String getLastLoginDateString() {
    return DateConvertUtils.format(getLastLoginDate(), "yyyy-MM-dd"); }

  public void setLastLoginDateString(String value) {
    setLastLoginDate(DateConvertUtils.parse(value, "yyyy-MM-dd", Date.class));
  }

  public void setLastLoginDate(Date value) {
    this.lastLoginDate = value;
  }

  public Date getLastLoginDate() {
    return this.lastLoginDate; }

  public String getRegDateString() {
    return DateConvertUtils.format(getRegDate(), "yyyy-MM-dd"); }

  public void setRegDateString(String value) {
    setRegDate(DateConvertUtils.parse(value, "yyyy-MM-dd", Date.class));
  }

  public void setRegDate(Date value) {
    this.regDate = value;
  }

  public Date getRegDate() {
    return this.regDate;
  }

  public String toString() {
    return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append
      ("MemberId", getMemberId()).append
      ("LoginName", getLoginName()).append
      ("Password", getPassword()).append
      ("Signature", getSignature()).append
      ("HeadImage", getHeadImage()).append
      ("Sex", getSex()).append
      ("TopicCount", getTopicCount()).append
      ("Email", getEmail()).append
      ("IsEmailVerify", getIsEmailVerify()).append
      ("MobileNumber", getMobileNumber()).append
      ("IsMobileVerify", getIsMobileVerify()).append
      ("RegSource", getRegSource()).append
      ("AppSource", getAppSource()).append
      ("AppVersion", getAppVersion()).append
      ("ThirdPartyToken", getThirdPartyToken()).append
      ("LastLoginDate", getLastLoginDate()).append
      ("RegDate", getRegDate()).toString
      ();
  }

  public int hashCode() {
    return new HashCodeBuilder().append
      (getMemberId()).toHashCode
      ();
  }

  public boolean equals(Object obj) {
    if (!(obj instanceof SmgMember)) return false;
    if (this == obj) return true;
    SmgMember other = (SmgMember)obj;
    return new EqualsBuilder().append
      (getMemberId(), other.getMemberId()).isEquals
      ();
  }

  public String getNickName()
  {
    return this.nickName;
  }

  public void setNickName(String nickName)
  {
    this.nickName = nickName;
  }

  public void setIsNewMember(int isNewMember) {
    this.isNewMember = isNewMember;
  }
}